import { _decorator, Component, director } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('menuBtn')
export class menuBtn extends Component {
    start() {
        director.addPersistRootNode(this.node);

        let menubox=this.node.getChildByName('menuBtn').getChildByName('menubox');

        this.node.getChildByName('menuBtn').on('click', () => {
            menubox.active = !menubox.active;
        });

        menubox.children.forEach((el) => {
            el.on('click', () => {
                menubox.active = false;
                director.loadScene(el.name);
            });
        });

    }

    update(deltaTime: number) {
        
    }
}


